//******************************************************************************
/**
 *
 * @file	fieldobj_draw_0.c
 * @brief	フィールドOBJ 基本描画系その0
 * @author	kagaya
 * @data	05.07.25
 *
 */
//******************************************************************************
#include "common.h"
#include "fieldsys.h"
#include "fieldobj.h"
#include "fieldobj_draw_legendpoke.h"

#include "field_effect.h"

//↓ポケモン連れ歩きのために追加
#include "ev_pokemon.h"
#include "pair_poke.h"
#include "../fielddata/script/pair_scr_def.h"

#include "pair_poke_humor.h"

//==============================================================================
//	define
//==============================================================================

//==============================================================================
//	typedef
//==============================================================================
//--------------------------------------------------------------
///	BLACT00_WORK構造体
//--------------------------------------------------------------
typedef struct
{
	s16 frame;			//4
	s8 old_dir;
	s8 old_state;
	BLACT_WORK_PTR act;	//4
	FIELD_OBJ_BLACTANM_PUSH act_push;	//8
}BLACT00_WORK;

#define BLACT00_WORK_SIZE (sizeof(BLACT00_WORK))

//--------------------------------------------------------------
///	BLACT_PPOKE_WORK構造体
//--------------------------------------------------------------
typedef struct
{
	BLACT_WORK_PTR act;
	FIELD_OBJ_BLACTANM_PUSH act_push;
	s8 old_dir;
	s8 frame;
	s8 sdw_dir_ofs_x;
	s8 sdw_dir_ofs_z;
	s8 react_ofs_y;
	u8 d_flg;
	u8 Dummy;
	u8 first_draw:1;
	u8 obj_code_setup:1;
	u8 ReactOfs:1;
	u8 dummy:5;

}BLACT_PPOKE_WORK;

#define BLACT_PPOKE_WORK_SIZE (sizeof(BLACT_PPOKE_WORK))

#if 0
//--------------------------------------------------------------
///	BLACTKOIKING_WORK構造体
//--------------------------------------------------------------
typedef struct
{
	s8 old_dir;
	s8 frame;
	s8 wait;
	s8 old_state;
	BLACT_WORK_PTR act;
	FIELD_OBJ_BLACTANM_PUSH act_push;
}BLACTKOIKING_WORK;

#define BLACTKOIKING_WORK_SIZE (sizeof(BLACTKOIKING_WORK))
#endif

//--------------------------------------------------------------
///	BLACTHERO_WORK構造体
//--------------------------------------------------------------
typedef struct
{
	s8 old_dir;
	s8 frame;
	s8 old_state;
	u8 be_dash_bit:1;
	u8 seq_no:7;

	BLACT_WORK_PTR act;
	FIELD_OBJ_BLACTANM_PUSH act_push;
}BLACTHERO_WORK;

#define BLACTHERO_WORK_SIZE (sizeof(BLACTHERO_WORK))

//--------------------------------------------------------------
///	MODEL00_WORK構造体
//--------------------------------------------------------------
typedef struct
{
	EOA_PTR eoa;
}MODEL00_WORK;

#define MODEL00_WORK_SIZE (sizeof(MODEL00_WORK))

//==============================================================================
//	プロトタイプ
//==============================================================================
void FieldOBJ_DrawBlAct00_Init( FIELD_OBJ_PTR fldobj );
void FieldOBJ_DrawBlAct00_Delete( FIELD_OBJ_PTR fldobj );
void FieldOBJ_DrawBlAct00_Push( FIELD_OBJ_PTR fldobj );
void FieldOBJ_DrawBlAct00_Pop( FIELD_OBJ_PTR fldobj );
void FieldOBJ_DrawBlActPairPoke_Pop( FIELD_OBJ_PTR fldobj );

void FieldOBJ_DrawBlAct00_Draw( FIELD_OBJ_PTR fldobj );
void FieldOBJ_DrawBlAct00AnmNon_Draw( FIELD_OBJ_PTR fldobj );

static void DrawBlAct00Draw_STA_STOP(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir );
static void DrawBlAct00Draw_STA_WALK_32F_16F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir );
static void DrawBlAct00Draw_STA_WALK_8F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir );
static void DrawBlAct00Draw_STA_WALK_4F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir );
static void DrawBlAct00Draw_STA_WALK_2F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir );
static void DrawBlAct00Draw_STA_WALK_6F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir );
static void DrawBlAct00Draw_STA_WALK_3F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir );

void (* const DATA_DrawBlAct00_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACT00_WORK *, int );

void (* const DATA_DrawBlActPcwoman_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACT00_WORK *, int );

static void DrawBlActeroDraw_STA_DASH_4F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir );

void (* const DATA_DrawBlActHero_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int );

static void DrawBlActHeroDraw_STA_TAKE_OFF_16F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir );
static void DrawBlActHeroDraw_STA_TAKE_OFF_8F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir );

void (* const DATA_DrawBlActHeroCycle_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int );

static void Draw_BlActAnmFrameStepSet( BLACT_WORK_PTR act, int step_frame );
static void Draw_BlActAnmFrameStopSet( BLACT_WORK_PTR act );
static void Draw_BlActAnmFrameStepSetOffsChg( BLACT_WORK_PTR act, int offs, int step_frame );
static void Draw_BlActAnmFrameStopSetOffsChg( BLACT_WORK_PTR act, int offs );
static void Draw_BlActFlagVanishSet( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act );
static void DrawModelOffsetGet( u32 code, VecFx32 *mtx );

static void DrawBlActPairPoke( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act,
		BLACT_PPOKE_WORK *work, const int inDir, const BOOL inDispOfs  );
static void GetParPokeDrawOfs(FIELD_OBJ_PTR fldobj, int dir, VecFx32 *outVec);

const BOOL NeedOfs(const u8 inDir, FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act);

//==============================================================================
//	BlAct00
//==============================================================================
//--------------------------------------------------------------
/**
 * ビルボードアクターポインタ取得
 * @param
 * @retval
 */
//--------------------------------------------------------------
BLACT_WORK_PTR FieldOBJ_DrawBlAct00_BlActPtrGet( FIELD_OBJ_PTR fldobj )
{
	int code = FieldOBJ_OBJCodeGet( fldobj );

	switch( code ){
	case HERO:
	case HEROINE:
	case CYCLEHERO:
	case CYCLEHEROINE:
	case SPHERO:
	case SPHEROINE:
	case SWIMHERO:
	case SWIMHEROINE:
	case WATERHERO:
	case WATERHEROINE:
	case SAVEHERO:
	case SAVEHEROINE:
///	case CONTESTHERO:		//金銀未使用
///	case CONTESTHEROINE:	//金銀未使用
	case FISHINGHERO:
	case FISHINGHEROINE:
	case POKEHERO:
	case POKEHEROINE:
	case BANZAIHERO:
	case BANZAIHEROINE:
	case LADDERHERO:
	case LADDERHEROINE:
	case RHERO:
	case RHEROINE:
	case BANZAIRHERO:
	case BANZAIRHEROINE:
		{
			BLACTHERO_WORK *work;
			work = FieldOBJ_DrawProcWorkGet( fldobj );
			return( work->act );
		}
#if 0		//金銀では未使用
	case KOIKING:
		{
			BLACTKOIKING_WORK *work;
			work = FieldOBJ_DrawProcWorkGet( fldobj );
			return( work->act );
		}
	case SPPOKE1:
	case SPPOKE2:
	case SPPOKE3:
		{
			return( FieldOBJ_DrawLegend_GetBlActWorkPtr(fldobj) );
		}
#endif
	default:
		if ( (PAIR_POKE_CODEORG<=code)&&(code<=PAIR_POKE_CODE_END) ){
			BLACT_PPOKE_WORK *work;
			work = FieldOBJ_DrawProcWorkGet( fldobj );
			return( work->act );
		}else if ( (BONGURI<=code)&&(code<=BONGURI07) ){
			return FieldOBJ_BongGetBlActPtr( fldobj );
		}else{
			BLACT00_WORK *work;
			work = FieldOBJ_DrawProcWorkGet( fldobj );
			return( work->act );
		}
	}

	return( NULL );
}

//--------------------------------------------------------------
/**
 * BlAct00 初期化。
 * 描画の為の初期化を行う。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlAct00_Init( FIELD_OBJ_PTR fldobj )
{
	BLACT00_WORK *work;

	work = FieldOBJ_DrawProcWorkInit( fldobj, BLACT00_WORK_SIZE );
	work->old_dir = DIR_NOT;
	FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );

	if( work->act != NULL ){
		FieldOBJ_DrawProcCall( fldobj );
	}
}

//--------------------------------------------------------------
/**
 * BlAct00 削除関数。
 * 描画で使用したモノを削除
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlAct00_Delete( FIELD_OBJ_PTR fldobj )
{
	BLACT00_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );
	FieldOBJ_BlActDelete( fldobj, &work->act );
}

//--------------------------------------------------------------
/**
 * BlAct00 退避。
 * 描画に必要な情報を退避し、描画で使用したモノを削除
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlAct00_Push( FIELD_OBJ_PTR fldobj )
{
	BLACT00_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( work->act != NULL ){
		FieldOBJ_BlActAnmPush( work->act, &work->act_push );
	}

	FieldOBJ_BlActDelete( fldobj, &work->act );
	FieldOBJ_StatusBit_ON( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );
}

//--------------------------------------------------------------
/**
 * BlAct00 復帰
 * 退避した情報を元に再描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlAct00_Pop( FIELD_OBJ_PTR fldobj )
{
	int ret;
	BLACT00_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){
		return;
	}

	if( work->act == NULL ){
		FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );
	}

	if( work->act != NULL ){
		FieldOBJ_BlActAnmPop( work->act, &work->act_push );
		FieldOBJ_BlActPosSet( fldobj, work->act );
		FieldOBJ_StatusBit_OFF( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );
	}
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモン 初期化。
 * 描画の為の初期化を行う。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPairPoke_Init( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;

	work = FieldOBJ_DrawProcWorkInit( fldobj, BLACT_PPOKE_WORK_SIZE );
	work->old_dir = DIR_NOT;
	FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );
	{
		work->d_flg = 0;
		work->obj_code_setup = 0;
		work->first_draw = 0;
	}

	if( work->act != NULL ){
		FieldOBJ_DrawProcCall( fldobj );
	}
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモン 削除関数。
 * 描画で使用したモノを削除
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPairPoke_Delete( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );
	FieldOBJ_BlActDelete( fldobj, &work->act );
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモン 退避。
 * 描画に必要な情報を退避し、描画で使用したモノを削除
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPairPoke_Push( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( work->act != NULL ){
		FieldOBJ_BlActAnmPush( work->act, &work->act_push );
	}

	//コード初期化
	work->obj_code_setup = 0;
	work->first_draw = 0;

	FieldOBJ_BlActDelete( fldobj, &work->act );
	FieldOBJ_StatusBit_ON( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモン 復帰
 * 退避した情報を元に再描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPairPoke_Pop( FIELD_OBJ_PTR fldobj )
{
	int ret;
	BLACT_PPOKE_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	//コードセット
	if ( (!work->obj_code_setup)&&( FieldOBJ_OBJIDGet( fldobj )== FLDOBJ_ID_POKE_PAIR)){
		//フィールドOBJシステムポインタ取得
		CONST_FIELD_OBJ_SYS_PTR fos =  FieldOBJ_FieldOBJSysGet( fldobj );
		//ｆｓｙｓ取得
		FIELDSYS_WORK *fsys = FieldOBJSys_FieldSysWorkGet( fos );
		//手持ちパーティ取得
		POKEPARTY *my_party = SaveData_GetTemotiPokemon(fsys->savedata);
		//パーティーからポケモンパラム取得
		POKEMON_PARAM *pp = EvPoke_GetLivingPokemonTop(my_party);
		//モンスターナンバーを取得
		int monsno = PokeParaGet(pp,ID_PARA_monsno,NULL);
		//フォルムナンバーを取得
		int formno = PokeParaGet(pp,ID_PARA_form_no,NULL);
		//性別
		u8 sex = PokeSexGet(pp);
		//モンスターナンバーをOBJコードに変換
		int obj_code = PairPoke_GetObjCodeFromMonsNo(monsno, formno, sex);
		//レア
		u8 rare = PokeRareGet(pp);

		work->obj_code_setup = 1;

		//連れ歩きポケモン情報書き換え
		PairPoke_SetInfo(fldobj, monsno, formno, rare);

		FieldOBJ_OBJCodeSet(fldobj, obj_code);
		FldOBJ_DrawProcChange(fldobj);

		//ステータスビット
		{
			FieldOBJ_StatusBit_ON( fldobj,
			FLDOBJ_STA_BIT_MOVE_START );
		}

		//座標再セット
		{
			int pos;
			VecFx32 vec;

			FieldOBJ_VecPosGet( fldobj, &vec );

			pos = FieldOBJ_NowPosGX_Get( fldobj );
			vec.x = GRID_SIZE_FX32( pos ) + FLDOBJ_VEC_X_GRID_OFFS_FX32;
			FieldOBJ_OldPosGX_Set( fldobj, pos );

			pos = FieldOBJ_NowPosGY_Get( fldobj );
			FieldOBJ_OldPosGY_Set( fldobj, pos );

			pos = FieldOBJ_NowPosGZ_Get( fldobj );
			vec.z = GRID_SIZE_FX32( pos ) + FLDOBJ_VEC_Z_GRID_OFFS_FX32;
			FieldOBJ_OldPosGZ_Set( fldobj, pos );

			FieldOBJ_VecPosSet( fldobj, &vec );
		}
		//アニメクリア
		{
			FieldOBJ_AcmdFree( fldobj );
		}

		//入れ替えが発生した場合の処理
		if ( (fsys->PairPokeWork.MonsNo != monsno) ||
			 (fsys->PairPokeWork.Form != formno) ||
			 (fsys->PairPokeWork.Rare != rare) ||
			 (fsys->PairPokeWork.Sex != sex) ){
			PairPoke_SetPokeInfoToWork(fsys, monsno, formno, rare, sex);
			//方向を下向き
			FieldOBJ_DirDispSetForce( fldobj, DIR_DOWN );
			OS_Printf("入れ替えが発生したのでデータの書き換えを向き変更\n");
		}

		//連れ歩きポケモン機嫌値セット
		{
			int rnd = PokeParaGet(pp,ID_PARA_personal_rnd,NULL);
			PAIR_POKE_HUMOR_SetPoke(fsys->PairPokeHumor, pp, monsno, rnd);
		}
	}

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){
		return;
	}

	if( work->act == NULL ){
		FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );
	}

	if( work->act != NULL ){
		work->first_draw = 1;
		//描画オフセット再設定
		{
			int obj_code;
			VecFx32 ofs,new_ofs = {0,0,0};
			FieldOBJ_VecDrawOffsGet( fldobj, &ofs );
			obj_code = FieldOBJ_OBJCodeGet(fldobj);
			GetParPokeDrawOfs( fldobj, FieldOBJ_DirDispGet( fldobj ), &new_ofs );
			ofs.x = new_ofs.x;
			ofs.z = new_ofs.z;
			FieldOBJ_VecDrawOffsSet( fldobj, &ofs );

		}

		if( PairPoke_IsSetViewObj(fldobj)){
			PairPoke_SetView(TRUE, fldobj, work->act);
		}else if (PairPoke_IsRare(fldobj)){
			PairPoke_SetColor(TRUE, fldobj, work->act);
		}
		FieldOBJ_BlActAnmPop( work->act, &work->act_push );
		FieldOBJ_BlActPosSet( fldobj, work->act );
		FieldOBJ_StatusBit_OFF( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );

		//描画
		FieldOBJ_DrawProcCall( fldobj );
	}
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモン アニメ開始時の初期化　上下オフセットを元に戻す
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_PairPokeInitStartAnm( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;
	VecFx32 *vec;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	work->d_flg = 0;
	vec = FieldOBJ_VecDrawOffsPtrGet( fldobj );
	//ｙオフセットを0にする
	vec->y = 0;
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモン	アクターポインタ取得
 * @param	fos			フィールドＯＢＪシステムポインタ
 * @retval	act			アクターポインタ
 */
//--------------------------------------------------------------
BLACT_WORK_PTR FldOBJ_GetPairPokeAct(CONST_FIELD_OBJ_SYS_PTR fos)
{
	BLACT_PPOKE_WORK *work;
	FIELD_OBJ_PTR fldobj;
	fldobj = FieldOBJSys_OBJIDSearch( fos, FLDOBJ_ID_POKE_PAIR );
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	return work->act;
}

//==============================================================================
//	BlAct00	描画
//==============================================================================
//--------------------------------------------------------------
/**
 * BlAct00 描画。
 * フィールドOBJから描画に必要な情報を取得し、描画する。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlAct00_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACT00_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_MAX && "FieldOBJ_DrawBlAct00_Draw()描画ステータス異常" );
	DATA_DrawBlAct00_DrawTbl[state]( fldobj, act, work, dir );

	//描画オフセット(連れ歩きポケモンより前になるように)
	{
		VecFx32 *vec_ptr;
		vec_ptr = FieldOBJ_VecDrawOffsPtrGet( fldobj );
		vec_ptr->z = FX32_ONE/2;
	}

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlAct00 描画。アニメなし
 * フィールドOBJから描画に必要な情報を取得し、描画する。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlAct00AnmNon_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,no;
	BLACT00_WORK *work;
	BLACT_WORK_PTR act;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){
		return;													//追加中
	}

	act = work->act;

	if( act == NULL ){
		return;
	}

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlAct00 描画。１パターンアニメ
 * フィールドOBJから描画に必要な情報を取得し、描画する。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlAct00AnmOneP_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,no;
	BLACT00_WORK *work;
	BLACT_WORK_PTR act;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){
		return;													//追加中
	}

	act = work->act;

	if( act == NULL ){
		return;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * test
 * BlAct00 描画。
 * フィールドOBJから描画に必要な情報を取得し、描画する。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPairPoke( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACT_PPOKE_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	if (!work->first_draw){
		work->first_draw = 1;
		if( PairPoke_IsSetViewObj(fldobj)){
			PairPoke_SetView(TRUE, fldobj, work->act);
		}else if ( PairPoke_IsRare(fldobj) ){
			PairPoke_SetColor(TRUE, fldobj, act);
		}
	}

	dir = FieldOBJ_DirDispGet( fldobj );
/**
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_MAX && "FieldOBJ_DrawBlAct00_DrawTest()描画ステータス異常" );
	DATA_DrawBlAct00_DrawTbl[state]( fldobj, act, work, dir );
*/
	DrawBlActPairPoke( fldobj, act, work, dir, TRUE );

	work->old_dir = dir;
///	work->old_state = FieldOBJ_DrawStatusGet( fldobj );<<070622del

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlAct00 描画。
 * フィールドOBJから描画に必要な情報を取得し、描画する。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPairPokeNoOfs( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACT_PPOKE_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	if (!work->first_draw){
		work->first_draw = 1;
		if( PairPoke_IsSetViewObj(fldobj)){
			PairPoke_SetView(TRUE, fldobj, work->act);
		}else if ( PairPoke_IsRare(fldobj) ){
			PairPoke_SetColor(TRUE, fldobj, act);
		}
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	DrawBlActPairPoke( fldobj, act, work, dir, TRUE );

	work->old_dir = dir;
///	work->old_state = FieldOBJ_DrawStatusGet( fldobj );<<070622del

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * 連れ歩き 描画。アニメなし
 * フィールドOBJから描画に必要な情報を取得し、描画する。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPairPokeNonAnm( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;
	BLACT_WORK_PTR act;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){
		return;													//追加中
	}

	act = work->act;

	if( act == NULL ){
		return;
	}

	if (!work->first_draw){
		work->first_draw = 1;
		if ( PairPoke_IsRare(fldobj) ){
			PairPoke_SetColor(TRUE, fldobj, act);
		}
	}

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモンの上下移動オフセットフラグを返す
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	u8		0: オフセットなし　1:下にずらしている
 */
//--------------------------------------------------------------
u8 FieldOBJ_DrawBlAct_GetUpDownOfsFlg( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	return work->d_flg;
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_STOP
 *
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_STOP(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else{
		Draw_BlActAnmFrameStopSet( act );
	}

	BLACT_AnmFrameChg( act, 0 );	//画面反映
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_WALK_32F 16F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACT00_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_WALK_32F_16F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_05 );
	}
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_WALK_8F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACT00_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_WALK_8F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_WALK_4F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACT00_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_WALK_4F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_2 );
	}
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_WALK_2F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACT00_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_WALK_2F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_4 );
	}
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_WALK_6F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACT00_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_WALK_6F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->frame = 0;
	}

	if( work->old_state != DRAW_STA_WALK_6F ){
		work->frame = 0;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		fx32 tbl[] = {
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_2,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_2, 0 };

		BLACT_AnmFrameChg( act, tbl[work->frame] );

		work->frame++;

		if( tbl[work->frame] == 0 ){
			work->frame = 0;
		}
	}
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_WALK_3F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACT00_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_WALK_3F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->frame = 0;
	}

	if(	work->old_state != DRAW_STA_WALK_3F ){
		work->frame = 0;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		fx32 tbl[] = {
			BLACTANM_FRAME_3,
			BLACTANM_FRAME_2,
			BLACTANM_FRAME_3, 0 };

		BLACT_AnmFrameChg( act, tbl[work->frame] );
		work->frame++;

		if( tbl[work->frame] == 0 ){
			work->frame = 0;
		}
	}
}

//--------------------------------------------------------------
/**
 * BlAct00 DRAW_STA_WALK_7F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACT00_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlAct00Draw_STA_WALK_7F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->frame = 0;
	}

	if( work->old_state != DRAW_STA_WALK_7F ){
		work->frame = 0;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		fx32 tbl[] = {
			BLACTANM_FRAME_2,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_1,
			BLACTANM_FRAME_1, 0 };

		BLACT_AnmFrameChg( act, tbl[work->frame] );

		work->frame++;

		if( tbl[work->frame] == 0 ){
			work->frame = 0;
		}
	}
}

//--------------------------------------------------------------
///	BlAct00 描画テーブル
//--------------------------------------------------------------
static void (* const DATA_DrawBlAct00_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACT00_WORK *, int ) =
{
	DrawBlAct00Draw_STA_STOP,
	DrawBlAct00Draw_STA_WALK_32F_16F,
	DrawBlAct00Draw_STA_WALK_32F_16F,
	DrawBlAct00Draw_STA_WALK_8F,
	DrawBlAct00Draw_STA_WALK_4F,
	DrawBlAct00Draw_STA_WALK_2F,
	DrawBlAct00Draw_STA_WALK_6F,
	DrawBlAct00Draw_STA_WALK_3F,
	DrawBlAct00Draw_STA_WALK_7F,
};

//==============================================================================
//	BlActPcwoman
//==============================================================================
//--------------------------------------------------------------
/**
 * BlActPcwoman 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActPcWoman_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACT00_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_PCWOMAN_MAX &&
			"FieldOBJ_DrawBlActPcwoman_Draw()描画ステータス異常" );
	DATA_DrawBlActPcwoman_DrawTbl[state]( fldobj, act, work, dir );

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActPcwoman DRAW_STA_STOP
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActPcwoman_STA_STOP(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( dir != work->old_dir || work->old_state == DRAW_STA_PC_BOW ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else{
		Draw_BlActAnmFrameStopSet( act );
	}

	BLACT_AnmFrameChg( act, 0 );	//画面反映
}

//--------------------------------------------------------------
/**
 * BlActPcwoman DRAW_STA_PC_BOW
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActPcwoman_STA_PC_BOW(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT00_WORK *work, int dir )
{
	if( work->old_state != DRAW_STA_PC_BOW ){
		BLACT_AnmOffsChg( act, 4 );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
}

//--------------------------------------------------------------
///	BlActPcwoman 描画テーブル
//--------------------------------------------------------------
static void (* const DATA_DrawBlActPcwoman_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACT00_WORK *, int ) =
{
	DrawBlActPcwoman_STA_STOP,
	DrawBlAct00Draw_STA_WALK_32F_16F,
	DrawBlAct00Draw_STA_WALK_32F_16F,
	DrawBlAct00Draw_STA_WALK_8F,
	DrawBlAct00Draw_STA_WALK_4F,
	DrawBlAct00Draw_STA_WALK_2F,
	DrawBlAct00Draw_STA_WALK_6F,
	DrawBlAct00Draw_STA_WALK_3F,
	DrawBlAct00Draw_STA_WALK_7F,

	DrawBlActPcwoman_STA_PC_BOW,
};
#if 0
//==============================================================================
//	BlActKoiking
//==============================================================================
//--------------------------------------------------------------
/**
 * BlActKoiking 初期化。
 * 描画の為の初期化を行う。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActKoiking_Init( FIELD_OBJ_PTR fldobj )
{
	BLACTKOIKING_WORK *work;

	work = FieldOBJ_DrawProcWorkInit( fldobj, BLACTKOIKING_WORK_SIZE );
	work->old_dir = DIR_NOT;
	work->wait = gf_rand() % 16;
	FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );

	if( work->act != NULL ){
		FieldOBJ_DrawProcCall( fldobj );
	}
}

//--------------------------------------------------------------
/**
 * BlActKoiking 削除関数。
 * 描画で使用したモノを削除
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActKoiking_Delete( FIELD_OBJ_PTR fldobj )
{
	BLACTKOIKING_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	FieldOBJ_BlActDelete( fldobj, &work->act );
}

//--------------------------------------------------------------
/**
 * BlActKoiking 退避。
 * 描画に必要な情報を退避し、描画で使用したモノを削除
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActKoiking_Push( FIELD_OBJ_PTR fldobj )
{
	BLACTKOIKING_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( work->act != NULL ){
		FieldOBJ_BlActAnmPush( work->act, &work->act_push );
	}

	FieldOBJ_BlActDelete( fldobj, &work->act );
	FieldOBJ_StatusBit_ON( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );
}

//--------------------------------------------------------------
/**
 * BlActKoiking 復帰
 * 退避した情報を元に再描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActKoiking_Pop( FIELD_OBJ_PTR fldobj )
{
	int ret;
	BLACTKOIKING_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){
		return;
	}

	if( work->act == NULL ){
		FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );
	}

	if( work->act != NULL ){
		FieldOBJ_BlActAnmPop( work->act, &work->act_push );
		FieldOBJ_BlActPosSet( fldobj, work->act );
		FieldOBJ_StatusBit_OFF( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );
	}
}

//--------------------------------------------------------------
/**
 * BlActKoiking 描画。常にぴちぴち
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActKoiking_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTKOIKING_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	if( work->wait ){
		work->wait--;
		BLACT_AnmFrameChg( act, 0 );
	}else{
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
		work->frame++;

		if( work->frame >= 32 ){
			work->frame = 0;
			work->wait = gf_rand() % 16;
		}
	}

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}
#endif

//==============================================================================
//	BlActBird
//==============================================================================
//--------------------------------------------------------------
/**
 * BlActBird 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActBird_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACT00_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	switch( state ){
	case DRAW_STA_STOP:
		{
			int no;

			if( dir == DIR_UP || dir == DIR_DOWN ){
				no = 0;
			}else{
				no = 1;
			}

			if( BLACT_AnmOffsGet(act) != no || work->old_state == DRAW_STA_STOP ){
				BLACT_AnmOffsChg( act, no );
				BLACT_AnmFrameSetOffs( act, 0 );
				BLACT_AnmFrameChg( act, 0 );
			}

			BLACT_AnmFrameChg( act, 0 );
		}
		break;
	default:
		{
			int no;
			fx32 frame = 0;

			if( dir == DIR_UP || dir == DIR_DOWN ){
				no = 0;
			}else{
				no = 1;
			}

			if( BLACT_AnmOffsGet(act) != no ){
				BLACT_AnmOffsChg( act, no );
				BLACT_AnmFrameSetOffs( act, 0 );
			}

			BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
		}

		break;
	}

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//==============================================================================
//	BlActHero
//==============================================================================
//--------------------------------------------------------------
/**
 * BlActHero 初期化。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHero_Init( FIELD_OBJ_PTR fldobj )
{
	BLACTHERO_WORK *work;

	work = FieldOBJ_DrawProcWorkInit( fldobj, BLACTHERO_WORK_SIZE );
	work->old_dir = DIR_NOT;
	FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );

	if( work->act != NULL ){
		FieldOBJ_DrawProcCall( fldobj );
	}
}

//--------------------------------------------------------------
/**
 * BlActHero 削除関数。
 * 描画で使用したモノを削除
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHero_Delete( FIELD_OBJ_PTR fldobj )
{
	BLACTHERO_WORK *work;
	VecFx32 vec = {0,0,0};

	work = FieldOBJ_DrawProcWorkGet( fldobj );
	FieldOBJ_BlActDelete( fldobj, &work->act );
	FieldOBJ_VecDrawOffsSet( fldobj, &vec );
}

//--------------------------------------------------------------
/**
 * BlActHero 退避。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHero_Push( FIELD_OBJ_PTR fldobj )
{
	BLACTHERO_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( work->act != NULL ){
		FieldOBJ_BlActAnmPush( work->act, &work->act_push );
	}

	FieldOBJ_BlActDelete( fldobj, &work->act );
	FieldOBJ_StatusBit_ON( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );
}

//--------------------------------------------------------------
/**
 * BlActHero 復帰
 * 退避した情報を元に再描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHero_Pop( FIELD_OBJ_PTR fldobj )
{
	int ret;
	BLACTHERO_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){
		return;
	}

	if( work->act == NULL ){
		FieldOBJ_BlActAddRegularGuest( fldobj, &work->act );
	}

	if( work->act != NULL ){
		FieldOBJ_BlActAnmPop( work->act, &work->act_push );
		FieldOBJ_BlActPosSet( fldobj, work->act );
		FieldOBJ_StatusBit_OFF( fldobj, FLDOBJ_STA_BIT_DRAW_PUSH );
	}
}

//==============================================================================
//	BlActHero 描画
//==============================================================================
//--------------------------------------------------------------
/**
 * BlActHero 自機描画
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHero_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_MAX_HERO && "FieldOBJ_DrawBlActHero_Draw()描画ステータス異常" );
	DATA_DrawBlActHero_DrawTbl[state]( fldobj, act, work, dir );

	//描画オフセット(連れ歩きポケモンより前になるように)
	{
		VecFx32 *vec_ptr;
		vec_ptr = FieldOBJ_VecDrawOffsPtrGet( fldobj );
		vec_ptr->z = FX32_ONE/2;
	}

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_STOP
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_STOP(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->be_dash_bit = FALSE;
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		//次のフレームで停止絵に変える
		work->be_dash_bit = TRUE;
	}else if( work->be_dash_bit == TRUE ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
		work->be_dash_bit = FALSE;
	}else{
		Draw_BlActAnmFrameStopSet( act );
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_WALK_32F 16F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_WALK_32F_16F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	int no;

	if( dir != work->old_dir ){
		no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		work->be_dash_bit = TRUE;
		return;
	}else if( work->be_dash_bit == TRUE ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
		work->be_dash_bit = FALSE;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_05 );
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_WALK_8F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_WALK_8F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	int no;

	if( dir != work->old_dir ){
		no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_WALK_4F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_WALK_4F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_2 );
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_WALK_2F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_WALK_2F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_4 );
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_WALK_6F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_WALK_6F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->frame = 0;
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
	}

	if( work->old_state != DRAW_STA_WALK_6F ){
		work->frame = 0;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		fx32 tbl[] = {
			BLACTANM_FRAME_1,BLACTANM_FRAME_1,BLACTANM_FRAME_2,
			BLACTANM_FRAME_1,BLACTANM_FRAME_1,BLACTANM_FRAME_2, 0 };

		BLACT_AnmFrameChg( act, tbl[work->frame] );
		work->frame++;

		if( tbl[work->frame] == 0 ){
			work->frame = 0;
		}
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_WALK_3F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_WALK_3F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->frame = 0;
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
	}

	if(	work->old_state != DRAW_STA_WALK_3F ){
		work->frame = 0;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		fx32 tbl[] = {
			BLACTANM_FRAME_3,BLACTANM_FRAME_2,BLACTANM_FRAME_3, 0 };

		BLACT_AnmFrameChg( act, tbl[work->frame] );
		work->frame++;

		if( tbl[work->frame] == 0 ){
			work->frame = 0;
		}
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_WALK_7F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_WALK_7F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	if( dir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->frame = 0;
	}else if( work->old_state == DRAW_STA_DASH_4F ){
		Draw_BlActAnmFrameStopSetOffsChg( act, FieldOBJ_BlActAnmOffsNo_DirWalkGet(dir) );
	}

	if( work->old_state != DRAW_STA_WALK_7F ){
		work->frame = 0;
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		fx32 tbl[] = {
			BLACTANM_FRAME_2,BLACTANM_FRAME_1,BLACTANM_FRAME_1,BLACTANM_FRAME_1,
			BLACTANM_FRAME_1,BLACTANM_FRAME_1,BLACTANM_FRAME_1, 0 };

		BLACT_AnmFrameChg( act, tbl[work->frame] );
		work->frame++;

		if( tbl[work->frame] == 0 ){
			work->frame = 0;
		}
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_DASH_4F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_DASH_4F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	int no;

	if( dir != work->old_dir ){
		no = FieldOBJ_BlActAnmOffsNo_DirDashGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( work->old_state != DRAW_STA_DASH_4F ){
		Draw_BlActAnmFrameStepSetOffsChg(
			act, FieldOBJ_BlActAnmOffsNo_DirDashGet(dir), BLACTANM_STEP_DASH_FRAME );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}
}

//--------------------------------------------------------------
///	BlActHero 描画テーブル
//--------------------------------------------------------------
static void (* const DATA_DrawBlActHero_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int ) =
{
	DrawBlActHeroDraw_STA_STOP,
	DrawBlActHeroDraw_STA_WALK_32F_16F,
	DrawBlActHeroDraw_STA_WALK_32F_16F,
	DrawBlActHeroDraw_STA_WALK_8F,
	DrawBlActHeroDraw_STA_WALK_4F,
	DrawBlActHeroDraw_STA_WALK_2F,
	DrawBlActHeroDraw_STA_WALK_6F,
	DrawBlActHeroDraw_STA_WALK_3F,
	DrawBlActHeroDraw_STA_WALK_7F,
	DrawBlActHeroDraw_STA_DASH_4F,
};

//==============================================================================
//	BlActHeroCycle
//==============================================================================
//--------------------------------------------------------------
/**
 * BlActHeroCycle 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroCycle_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_MAX_CYCLEHERO &&
			"FieldOBJ_DrawBlActHero_Draw()描画ステータス異常" );

	if( work->old_state == DRAW_STA_STOP &&
		state != work->old_state && work->be_dash_bit == FALSE ){
		work->old_dir = DIR_NOT;
	}

	DATA_DrawBlActHeroCycle_DrawTbl[state]( fldobj, act, work, dir );

	work->old_dir = dir;
	work->old_state = state;

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHeroCycle DRAW_STA_STOP
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroCycleDraw_STA_STOP(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	int dirno[4] = { 6, 7, 8, 9 };
	int no = dirno[dir];

	if( dir != work->old_dir ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->be_dash_bit = FALSE;
	}else if( work->old_state != DRAW_STA_STOP ){
		work->be_dash_bit = TRUE;
	}else if( work->be_dash_bit == TRUE ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->be_dash_bit = FALSE;
	}else{
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}

}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_TAKE_OFF_4F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_TAKE_OFF_16F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	int no;

	no = FieldOBJ_BlActAnmOffsNo_DirTakeOFFGet( dir );

	if( dir != work->old_dir || work->old_state != DRAW_STA_STOP ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( work->old_state != DRAW_STA_TAKE_OFF_16F ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( BLACT_AnmOffsGet(act) != no ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_05 );
	}
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_TAKE_OFF_8F
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroDraw_STA_TAKE_OFF_8F(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	int no;

	no = FieldOBJ_BlActAnmOffsNo_DirTakeOFFGet( dir );

	if( dir != work->old_dir ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( work->old_state != DRAW_STA_TAKE_OFF_8F ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}else if( BLACT_AnmOffsGet(act) != no ){
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	if( FieldOBJ_DrawPauseCheck(fldobj) == FALSE ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}
}

//--------------------------------------------------------------
///	BlActHeroCycle 描画テーブル
//--------------------------------------------------------------
#if 0	//old
static void (* const DATA_DrawBlActHeroCycle_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int ) =
{
	DrawBlActHeroCycleDraw_STA_STOP,
	DrawBlActHeroDraw_STA_WALK_32F_16F,
	DrawBlActHeroDraw_STA_WALK_32F_16F,
	DrawBlActHeroDraw_STA_WALK_8F,
	DrawBlActHeroDraw_STA_WALK_4F,
	DrawBlActHeroDraw_STA_WALK_2F,
	DrawBlActHeroDraw_STA_WALK_6F,
	DrawBlActHeroDraw_STA_WALK_3F,
	DrawBlActHeroDraw_STA_TAKE_OFF_16F,
	DrawBlActHeroDraw_STA_TAKE_OFF_8F,
};
#else
static void (* const DATA_DrawBlActHeroCycle_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int ) =
{
	DrawBlActHeroCycleDraw_STA_STOP,
	DrawBlActHeroDraw_STA_WALK_32F_16F,
	DrawBlActHeroDraw_STA_WALK_32F_16F,
	DrawBlActHeroDraw_STA_WALK_8F,
	DrawBlActHeroDraw_STA_WALK_4F,
	DrawBlActHeroDraw_STA_WALK_6F,
	DrawBlActHeroDraw_STA_WALK_6F,
	DrawBlActHeroDraw_STA_WALK_6F,
	DrawBlActHeroDraw_STA_TAKE_OFF_16F,
	DrawBlActHeroDraw_STA_TAKE_OFF_8F,
};
#endif

//==============================================================================
//	BlActHeroFishing
//==============================================================================
void (* const DATA_DrawBlActHeroFishing_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int );
static void DrawBlActHeroFishOffset( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, int dir );

//--------------------------------------------------------------
///	釣りアニメオフセット番号　方向
//--------------------------------------------------------------
static const int DATA_FishAnmOffsNoDirTbl[] =
{ 0, 1, 2, 3 };

//--------------------------------------------------------------
/**
 * BlActHeroFishing 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroFishing_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( act == NULL ||
		FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_MAX_FISH &&
			"FieldOBJ_DrawBlActHero_Draw()描画ステータス異常" );
	DATA_DrawBlActHeroFishing_DrawTbl[state]( fldobj, act, work, dir );
	DrawBlActHeroFishOffset( fldobj, act, dir );

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_FISH_END		0x00
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroFishDraw_STA_FISH_END(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	fx32 frame;

	if( dir != work->old_dir || work->old_state != DRAW_STA_FISH_END ){
		BLACT_AnmOffsChg( act, DATA_FishAnmOffsNoDirTbl[dir] );
		BLACT_AnmFrameSetOffs( act, NUM_FX32(15) );
	}

	frame = BLACT_AnmFrameGetOffs( act );
	frame -= BLACTANM_FRAME_1;
	if( frame < 0 ){ frame = 0; }
	BLACT_AnmFrameSetOffs( act, frame );
	BLACT_AnmFrameChg( act, 0 );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_FISH_START
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroFishDraw_STA_FISH_START(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	fx32 frame;

	if( dir != work->old_dir || work->old_state != DRAW_STA_FISH_START ){
		BLACT_AnmOffsChg( act, DATA_FishAnmOffsNoDirTbl[dir] );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_FISH_ON
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroFishDraw_STA_FISH_ON(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	fx32 frame;

	if( dir != work->old_dir || work->old_state != DRAW_STA_FISH_ON ){
		BLACT_AnmOffsChg( act, DATA_FishAnmOffsNoDirTbl[dir] );
		BLACT_AnmFrameSetOffs( act, NUM_FX32(15) );
		work->seq_no = 0;
	}

	frame = BLACT_AnmFrameGetOffs( act );

	switch( work->seq_no ){
	case 0:
		frame -= BLACTANM_FRAME_1;
		if( frame <= NUM_FX32(10) ){ work->seq_no++; }
		break;
	case 1:
		frame += BLACTANM_FRAME_1;
		if( frame >= NUM_FX32(15) ){ work->seq_no++; work->frame = 0; }
		break;
	case 2:
		work->frame++;
		if( work->frame >= 30 ){ work->frame = 0; work->seq_no = 0; }
	}

	BLACT_AnmFrameSetOffs( act, frame );
	BLACT_AnmFrameChg( act, 0 );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_FISH_HIT
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroFishDraw_STA_FISH_HIT(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	fx32 frame;

	if( dir != work->old_dir || work->old_state != DRAW_STA_FISH_HIT ){
		BLACT_AnmOffsChg( act, DATA_FishAnmOffsNoDirTbl[dir] );
		BLACT_AnmFrameSetOffs( act, NUM_FX32(15) );
	}

	frame = BLACT_AnmFrameGetOffs( act ) - BLACTANM_FRAME_1;
	if( frame < 0 ){ frame = 0; }
	BLACT_AnmFrameSetOffs( act, frame );
	BLACT_AnmFrameChg( act, 0 );
}

//--------------------------------------------------------------
/**
 * 釣りアニメ番号別にオフセットセット
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroFishOffset( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, int dir )
{
	VecFx32 vec = {0,0,0};
	int frame = FX32_NUM( BLACT_AnmFrameGet(act) );

	switch( dir ){
	case DIR_UP:
		break;
	case DIR_DOWN:
		if( frame >= 24 ){ vec.z = NUM_FX32(6); }
		break;
	case DIR_LEFT:
		if( frame < 40 ){ vec.x = NUM_FX32(1); }
		else{ vec.x = NUM_FX32(-5); }
		break;
	case DIR_RIGHT:
		if( frame < 56 ){ vec.x = NUM_FX32(-1); }
		else{ vec.x = NUM_FX32(5); }
		break;
	}
	//描画オフセット(連れ歩きポケモンより前になるように)
	{
		vec.z += (FX32_ONE/2);
	}

	FieldOBJ_VecDrawOffsSet( fldobj, &vec );
}

//--------------------------------------------------------------
///	BlActHero 描画テーブル
//--------------------------------------------------------------
static void (* const DATA_DrawBlActHeroFishing_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int ) =
{
	DrawBlActHeroFishDraw_STA_FISH_END,
	DrawBlActHeroFishDraw_STA_FISH_START,
	DrawBlActHeroFishDraw_STA_FISH_ON,
	DrawBlActHeroFishDraw_STA_FISH_HIT,
};

//==============================================================================
//	BlActHeroLadder
//==============================================================================
static void DrawBlActHeroLadderOffset( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, int dir );

//--------------------------------------------------------------
///	はしごアニメオフセット番号　方向
//--------------------------------------------------------------
void (* const DATA_DrawBlActHeroLadder_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int );
static const int DATA_LadderAnmOffsNoDirTbl[] =
{ 0, 1, 2, 3 };

//--------------------------------------------------------------
/**
 * BlActHeroLadder 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroLadder_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( act == NULL ||
		FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_MAX_LADDER &&
			"FieldOBJ_DrawBlActHero_Draw()描画ステータス異常" );
	DATA_DrawBlActHeroLadder_DrawTbl[state]( fldobj, act, work, dir );
	DrawBlActHeroLadderOffset( fldobj, act, dir );

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_LADDER_UP
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroLadderDraw_STA_LADDER_UP(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	fx32 frame;

	if( dir != work->old_dir || work->old_state != DRAW_STA_LADDER_UP ){
		BLACT_AnmOffsChg( act, DATA_LadderAnmOffsNoDirTbl[dir] );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_LADDER_DOWN
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroLadderDraw_STA_LADDER_DOWN(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	fx32 frame;

	if( dir != work->old_dir || work->old_state != DRAW_STA_LADDER_DOWN ){
		BLACT_AnmOffsChg( act, DATA_LadderAnmOffsNoDirTbl[dir] );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
}

//--------------------------------------------------------------
/**
 * はしごアニメ番号別にオフセットセット
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroLadderOffset( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, int dir )
{
	VecFx32 vec = {0,0,0};
	int frame = FX32_NUM( BLACT_AnmFrameGet(act) );

	switch( dir ){
	case DIR_UP:
		break;
	case DIR_DOWN:
		if( frame >= 24 ){ vec.z = NUM_FX32(6); }
		break;
	case DIR_LEFT:
		if( frame < 40 ){ vec.x = NUM_FX32(1); }
		else{ vec.x = NUM_FX32(-5); }
		break;
	case DIR_RIGHT:
		if( frame < 56 ){ vec.x = NUM_FX32(-1); }
		else{ vec.x = NUM_FX32(5); }
		break;
	}

	FieldOBJ_VecDrawOffsSet( fldobj, &vec );
}

//--------------------------------------------------------------
///	BlActHero 描画テーブル
//--------------------------------------------------------------
static void (* const DATA_DrawBlActHeroLadder_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int ) =
{
	DrawBlActHeroLadderDraw_STA_LADDER_UP,
	DrawBlActHeroLadderDraw_STA_LADDER_DOWN,
};

//==============================================================================
//	BlActHero　その他
//==============================================================================
//--------------------------------------------------------------
/**
 * BlActHeroSwim 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroSwim_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	{
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		BLACT_AnmFrameChg( act, 0 );
	}

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHeroSp 描画
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroSp_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	if( BLACT_AnmOffsGet(act) != 0 ){
		BLACT_AnmOffsChg( act, 0 );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );

	//描画オフセット(連れ歩きポケモンより前になるように)
	{
		VecFx32 *vec_ptr;
		vec_ptr = FieldOBJ_VecDrawOffsPtrGet( fldobj );
		vec_ptr->z = FX32_ONE/2;
	}

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHeroWater 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroWater_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	switch( state ){
	case DRAW_STA_STOP:
		if( BLACT_AnmOffsGet(act) != 1 ){
			BLACT_AnmOffsChg( act, 1 );
			BLACT_AnmFrameSetOffs( act, 0 );
		}

		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
		break;
	default:
		if( BLACT_AnmOffsGet(act) != 0 ){
			BLACT_AnmOffsChg( act, 0 );
			BLACT_AnmFrameSetOffs( act, 0 );
		}

		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHeroPoketch 描画
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroPoketch_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,no;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );

	if( dir != work->old_dir ){
		no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( dir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );
}

//--------------------------------------------------------------
/**
 * BlActHeroBanzai 描画
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroBanzai_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	if( act == NULL ){
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	if( state != work->old_state ){
		if( state == DRAW_STA_BANZAI ){
			BLACT_AnmOffsChg( act, 0 );
		}else{
			BLACT_AnmOffsChg( act, 1);
		}

		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );

	//描画オフセット(連れ歩きポケモンより前になるように)
	{
		VecFx32 *vec_ptr;
		vec_ptr = FieldOBJ_VecDrawOffsPtrGet( fldobj );
		vec_ptr->z = FX32_ONE/2;
	}

	work->old_dir = dir;
	work->old_state = state;

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//==============================================================================
//	BlActHeroShake
//==============================================================================
static void DrawBlActHeroShakeOffset( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, int dir );
//--------------------------------------------------------------
///	木揺らしアニメオフセット番号　方向
//--------------------------------------------------------------
void (* const DATA_DrawBlActHeroShake_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int );
static const int DATA_ShakeAnmOffsNoDirTbl[] =
{ 0, 1, 2, 3 };

//--------------------------------------------------------------
/**
 * BlActHeroShake 描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawBlActHeroShake_Draw( FIELD_OBJ_PTR fldobj )
{
	int dir,state;
	BLACTHERO_WORK *work = FieldOBJ_DrawProcWorkGet( fldobj );
	BLACT_WORK_PTR act = work->act;

	if( act == NULL ||
		FieldOBJ_BlActAddPracFlagCheck(fldobj) == TRUE ){		//追加中
		return;
	}

	dir = FieldOBJ_DirDispGet( fldobj );
	state = FieldOBJ_DrawStatusGet( fldobj );

	GF_ASSERT( state < DRAW_STA_MAX_SHAKE &&
			"FieldOBJ_DrawBlActHero_Draw()描画ステータス異常" );
	DATA_DrawBlActHeroShake_DrawTbl[state]( fldobj, act, work, dir );
	DrawBlActHeroShakeOffset( fldobj, act, dir );

	work->old_dir = dir;
	work->old_state = FieldOBJ_DrawStatusGet( fldobj );

	FieldOBJ_BlActPosSet( fldobj, act );
	Draw_BlActFlagVanishSet( fldobj, act );
}

//--------------------------------------------------------------
/**
 * BlActHero DRAW_STA_SHAKE
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	work	BLACTHERO_WORK *
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroShakeDraw_STA_SHAKE(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACTHERO_WORK *work, int dir )
{
	fx32 frame;

	if( dir != work->old_dir || work->old_state != DRAW_STA_SHAKE ){
		BLACT_AnmOffsChg( act, DATA_ShakeAnmOffsNoDirTbl[dir] );
		BLACT_AnmFrameSetOffs( act, 0 );
	}

	BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
}

//--------------------------------------------------------------
/**
 * 木揺らしアニメ番号別にオフセットセット
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @param	dir		表示方向DIR_UP等
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActHeroShakeOffset( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, int dir )
{
	VecFx32 vec = {0,0,0};
#if 0
	int frame = FX32_NUM( BLACT_AnmFrameGet(act) );

	switch( dir ){
	case DIR_UP:
		break;
	case DIR_DOWN:
		if( frame >= 24 ){ vec.z = NUM_FX32(6); }
		break;
	case DIR_LEFT:
		if( frame < 40 ){ vec.x = NUM_FX32(1); }
		else{ vec.x = NUM_FX32(-5); }
		break;
	case DIR_RIGHT:
		if( frame < 56 ){ vec.x = NUM_FX32(-1); }
		else{ vec.x = NUM_FX32(5); }
		break;
	}
#endif
	//描画オフセット(連れ歩きポケモンより前になるように)
	{
		vec.z += (FX32_ONE/2);
	}

	FieldOBJ_VecDrawOffsSet( fldobj, &vec );
}

//--------------------------------------------------------------
///	BlActHero 描画テーブル
//--------------------------------------------------------------
static void (* const DATA_DrawBlActHeroShake_DrawTbl[])(
		FIELD_OBJ_PTR, BLACT_WORK_PTR, BLACTHERO_WORK *, int ) =
{
	DrawBlActHeroShakeDraw_STA_SHAKE,
};


//==============================================================================
//	ビルボードパーツ
//==============================================================================
//--------------------------------------------------------------
/**
 * 一歩停止フレームセット。
 * 余分フレームを削除し、停止アニメに反映。
 * @param	act		BLACT_WORK_PTR
 * @param	step_frame	一歩分のフレーム
 * @retval	nothing
 */
//--------------------------------------------------------------
static void Draw_BlActAnmFrameStepSet( BLACT_WORK_PTR act, int step_frame )
{
	fx32 frame,mod;

	frame = BLACT_AnmFrameGetOffs( act );
	frame /= FX32_ONE;
	mod = frame % step_frame;
	frame -= mod;
	frame *= FX32_ONE;

	BLACT_AnmFrameSetOffs( act, frame );
	BLACT_AnmFrameChg( act, 0 );	//画面反映のみ
}

//--------------------------------------------------------------
/**
 * 標準停止フレームセット。
 * 余分フレームを削除し、停止アニメに反映。
 * @param	act		BLACT_WORK_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
static void Draw_BlActAnmFrameStopSet( BLACT_WORK_PTR act )
{
	Draw_BlActAnmFrameStepSet( act, BLACTANM_STEP_FRAME );
}

//--------------------------------------------------------------
/**
 * 現在の停止フレームを合わせた別オフセット停止
 * @param	act		BLACT_WORK_PTR
 * @param	offs	アニメオフセット
 * @param	step_frame	一歩分のフレーム
 * @retval	nothing
 */
//--------------------------------------------------------------
static void Draw_BlActAnmFrameStepSetOffsChg( BLACT_WORK_PTR act, int offs, int step_frame )
{
	fx32 frame;

	Draw_BlActAnmFrameStepSet( act, step_frame );
	frame = BLACT_AnmFrameGetOffs( act );
	BLACT_AnmOffsChg( act, offs );
	BLACT_AnmFrameSetOffs( act, frame );
}

//--------------------------------------------------------------
/**
 * 現在の標準停止フレームを合わせた別オフセット停止
 * @param	act		BLACT_WORK_PTR
 * @param	offs	アニメオフセット
 * @retval	nothing
 */
//--------------------------------------------------------------
static void Draw_BlActAnmFrameStopSetOffsChg( BLACT_WORK_PTR act, int offs )
{
	fx32 frame;

	Draw_BlActAnmFrameStopSet( act );
	frame = BLACT_AnmFrameGetOffs( act );
	BLACT_AnmOffsChg( act, offs );
	BLACT_AnmFrameSetOffs( act, frame );
}

//--------------------------------------------------------------
/**
 * 表示、非表示
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act		BLACT_WORK_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
static void Draw_BlActFlagVanishSet( FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act )
{
	int vanish = TRUE;

	if( FieldOBJ_StatusBit_CheckEasy(fldobj,FLDOBJ_STA_BIT_VANISH) == TRUE ){
		vanish = FALSE;
	}

	if( FieldOBJ_StatusBit_CheckEasy(fldobj,FLDOBJ_STA_BIT_HEIGHT_GET_ERROR) == TRUE ){
		if( FieldOBJ_StatusBit_CheckEasy(fldobj,FLDOBJ_STA_BIT_HEIGHT_VANISH_OFF) == FALSE){
			vanish = FALSE;
		}
	}

	BLACT_ObjDrawFlagSet( act, vanish );
}

//==============================================================================
///	Model00
//==============================================================================
//--------------------------------------------------------------
/**
 * 表示コード->オフセット
 * @param
 * @retval
 */
//--------------------------------------------------------------
static void DrawModelOffsetGet( u32 code, VecFx32 *mtx )
{
	const CODEOFFS *offs = DATA_FieldOBJRenderOBJDrawOffset;

	while( offs->code != OBJCODEMAX ){
		if( offs->code == code ){
			*mtx = offs->offs;
			return;
		}
		offs++;
	}

	GF_ASSERT( 0 );
}

//--------------------------------------------------------------
/**
 * Model00 初期化。描画の為の初期化を行う。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawModel00_Init( FIELD_OBJ_PTR fldobj )
{
	VecFx32 offs;
	MODEL00_WORK *work;
	work = FieldOBJ_DrawProcWorkInit( fldobj, MODEL00_WORK_SIZE );
	DrawModelOffsetGet( FieldOBJ_OBJCodeGet( fldobj ), &offs );
	work->eoa = FE_FldROBJ_Add( fldobj, &offs );
}

//--------------------------------------------------------------
/**
 * Model00 描画。フィールドOBJから描画に必要な情報を取得し、描画する。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawModel00_Draw( FIELD_OBJ_PTR fldobj )
{
}

//--------------------------------------------------------------
/**
 * Model00 削除関数。
 * 描画で使用したモノを削除
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
void FieldOBJ_DrawModel00_Delete( FIELD_OBJ_PTR fldobj )
{
	MODEL00_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( work->eoa != NULL ){
		FE_EoaDelete( work->eoa );
		work->eoa = NULL;
	}
}

//--------------------------------------------------------------
/**
 * Model00 退避。
 * 描画に必要な情報を退避し、描画で使用したモノを削除
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawModel00_Push( FIELD_OBJ_PTR fldobj )
{
	MODEL00_WORK *work;

	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if( work->eoa != NULL ){
		FE_EoaDelete( work->eoa );
		work->eoa = NULL;
	}
}

//--------------------------------------------------------------
/**
 * Model00 復帰
 * 退避した情報を元に再描画。
 * @param	fldobj		FIELD_OBJ_PTR
 * @retval	int			TRUE=初期化成功
 */
//--------------------------------------------------------------
void FieldOBJ_DrawModel00_Pop( FIELD_OBJ_PTR fldobj )
{
	VecFx32 offs;
	MODEL00_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	DrawModelOffsetGet( FieldOBJ_OBJCodeGet( fldobj ), &offs );
	work->eoa = FE_FldROBJ_Add( fldobj, &offs );
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモン
 * @param	fldobj	FIELD_OBJ_PTR
 * @param	act			アクターワークポインタ
 * @param	work		ワーク
 * @param	inDir		方向
 * @param	inDispOfs	描画オフセットが必要かどうか（大きいポケモンのときTRUE）
 *
 * @retval	nothing
 */
//--------------------------------------------------------------
static void DrawBlActPairPoke(
		FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act, BLACT_PPOKE_WORK *work, const int inDir, const BOOL inDispOfs)
{
	VecFx32 vec;
	BOOL pause_check;
	BOOL anm_cmd_check;
	BOOL set_view_check;

	pause_check = FieldOBJ_DrawPauseCheck(fldobj);
	anm_cmd_check = FieldOBJ_StatusBitCheck_Acmd(fldobj);
	set_view_check = PairPoke_IsSetViewObj(fldobj);

	if (work->ReactOfs){
		FieldOBJ_VecDrawOffsGet( fldobj, &vec );	//現在オフセット取得
		//リアクションでのＹオフセット
		vec.y = work->react_ofs_y*FX32_ONE;
	}else{
		if (pause_check || anm_cmd_check || set_view_check){
			//yだけオフセットを引き継ぐ
			FieldOBJ_VecDrawOffsGet( fldobj, &vec );	//現在オフセット取得
			vec.x = 0;
			vec.z = 0;
			OS_Printf("ofs_y = %d\n",vec.y);
		}else{
			vec.x = 0;
			vec.y = 0;
			vec.z = 0;
		}
		if (inDispOfs){
			//方向から描画オフセットをつける
			GetParPokeDrawOfs(fldobj, inDir, &vec);
		}
		//ジャンプオフセット
		vec.y += PairPoke_GetJumpDrawOfs(fldobj);
	}

	if( inDir != work->old_dir ){
		int no = FieldOBJ_BlActAnmOffsNo_DirWalkGet( inDir );
		BLACT_AnmOffsChg( act, no );
		BLACT_AnmFrameSetOffs( act, 0 );
		work->d_flg = 0;
	}

	if( (pause_check==FALSE)&&(anm_cmd_check==FALSE) ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
//		OS_Printf("frame = %d \n",BLACT_AnmFrameGet( act )/FX32_ONE);
		if (NeedOfs(inDir, fldobj, act)){
			//下にずらす
			vec.y -= FX32_ONE*2;
			work->d_flg = 1;
		}else{
			work->d_flg = 0;
		}
	}

	if ( anm_cmd_check ){
		BLACT_AnmFrameChg( act, BLACTANM_FRAME_1 );
	}
	FieldOBJ_VecDrawOffsSet( fldobj, &vec );
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモンオフセット
 * @param	fldobj	FIELD_OBJ_PTR
 * @retval	nothing
 */
//--------------------------------------------------------------
static void GetParPokeDrawOfs(FIELD_OBJ_PTR fldobj, int dir, VecFx32 *outVec)
{
	int obj_code;
	VecFx32 ofs;
	FieldOBJ_VecDrawOffsGet( fldobj, &ofs );
	obj_code = FieldOBJ_OBJCodeGet(fldobj);
	//方向から描画オフセットをつける
	if ( FieldOBJ_BlActOBJCodeMdlIDGet( obj_code )==BLACT_MDLID_POKE_64x64 ){
		switch(dir){
		case DIR_UP:
			outVec->z += FX32_ONE*UPDOWN_DISP_OFS;
			break;
		case DIR_DOWN:
			outVec->z -= FX32_ONE*UPDOWN_DISP_OFS;
			break;
		case DIR_LEFT:
			outVec->x += FX32_ONE*RIGHTLEFT_DISP_OFS;
			break;
		case DIR_RIGHT:
			outVec->x -= FX32_ONE*RIGHTLEFT_DISP_OFS;
			break;
		}
	}else{
		switch(dir){
		case DIR_LEFT:
			outVec->x += FX32_ONE*RIGHTLEFT_DISP_OFS_S;
			break;
		case DIR_RIGHT:
			outVec->x -= FX32_ONE*RIGHTLEFT_DISP_OFS_S;
			break;
		}
	}
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモンリアクション中の方向変更による描画オフセット無効フラグ
 * フラグ成立で、大きいポケが向きを変えても、オフセットかからなくなる
 * @param	fldobj		FIELD_OBJ_PTR
 * @param	inFlg		0:方向オフセット無効フラグOFF　それ以外：方向オフセット無効フラグON
 * @return	none
 */
//--------------------------------------------------------------
void FieldOBJ_PairPokeReactDrawOfsFlg( FIELD_OBJ_PTR fldobj, const u8 inFlg )
{
	BLACT_PPOKE_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if (inFlg){
		VecFx32 vec = {0,0,0};
		work->ReactOfs = 1;
		FE_Shadow_AddBigShadowDrawOfs(FieldOBJ_DirDispGet( fldobj ), &vec);

		work->sdw_dir_ofs_x = vec.x/FX32_ONE;
		work->sdw_dir_ofs_z = vec.z/FX32_ONE;
	}else{
		work->ReactOfs = 0;
		work->sdw_dir_ofs_x = 0;
		work->sdw_dir_ofs_z = 0;
	}
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモンリアクション中のYオフセット指定
 * @param	fldobj		FIELD_OBJ_PTR
 * @param	inYOfs		Ｙオフセット
 * @return	none
 */
//--------------------------------------------------------------
void FieldOBJ_SetPairPokeReactYOfs( FIELD_OBJ_PTR fldobj, const s8 inYOfs )
{
	BLACT_PPOKE_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	work->react_ofs_y = inYOfs;
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモンリアクション中のYオフセット加算
 * @param	fldobj		FIELD_OBJ_PTR
 * @param	inYOfs		Ｙオフセット
 * @return	none
 */
//--------------------------------------------------------------
void FieldOBJ_AddPairPokeReactYOfs( FIELD_OBJ_PTR fldobj, const s8 inYOfs )
{
	BLACT_PPOKE_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	work->react_ofs_y += inYOfs;
}


//--------------------------------------------------------------
/**
 * 連れ歩きポケモンリアクション中の方向変更による描画オフセットが有効かどうか
 * @param	fldobj		FIELD_OBJ_PTR
 * @return	BOOL		TRUE:有効　FALSE:無効
 */
//--------------------------------------------------------------
BOOL FieldOBJ_IsValidPairPokeReactDrawOfs( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );

	if (work->ReactOfs){
		return FALSE;
	}
	return TRUE;
}

void FieldOBJ_GetPokeReactShadowOfs( FIELD_OBJ_PTR fldobj, VecFx32 *outVec )
{
	BLACT_PPOKE_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	outVec->x = work->sdw_dir_ofs_x*FX32_ONE;
	outVec->z = work->sdw_dir_ofs_z*FX32_ONE;
	outVec->y = 0;
}

//連れ歩きの上下移動
const BOOL NeedOfs(const u8 inDir, FIELD_OBJ_PTR fldobj, BLACT_WORK_PTR act)
{
	int frame = BLACT_AnmFrameGet( act )/FX32_ONE;
	switch(inDir){
	case DIR_UP:
		;
		break;
	case DIR_DOWN:
		frame-=20;
		break;
	case DIR_LEFT:
		frame -=40;
		break;
	case DIR_RIGHT:
		frame-=60;
		break;
	}

	if (PairPoke_GetInfo_AnmSpd(fldobj)){
		if (inDir == DIR_DOWN){
			if ((frame<5)||(15<=frame) ){
				//下にずらす
				return TRUE;
			}
		}else{
			if (frame<10){
				//下にずらす
				return TRUE;
			}
		}
	}else{
		if ( ((5<=frame)&&(frame<10)) || (15<=frame) ){
			//下にずらす
			return TRUE;
		}
	}

	return FALSE;
}

//--------------------------------------------------------------
/**
 * 連れ歩きポケモンカラーパレットセット
 *
 * @param	inRare		レアカラーか？	TRUEでレアカラー
 * @param	fldobj		FIELD_OBJ_PTR
 * @return	none
 */
//--------------------------------------------------------------
void FieldOBJ_SetPokeColorPlt( const BOOL inRare, FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	PairPoke_SetColor(inRare, fldobj, work->act);
}

//--------------------------------------------------------------
/**
 * 初回描画フラグをクリア　クリアするともう一回初回描画する（レアカラーセットのときに使用する）
 *
 * @param	fldobj		FIELD_OBJ_PTR
 * @return	none
 */
//--------------------------------------------------------------
void FieldOBJ_SetFirstDrawFlgOFF( FIELD_OBJ_PTR fldobj )
{
	BLACT_PPOKE_WORK *work;
	work = FieldOBJ_DrawProcWorkGet( fldobj );
	work->first_draw = 0;
}

